# Contributor: Anil Madhavapeddy <anil@recoil.org>
# Maintainer:
pkgname=clasp
pkgver=3.3.7
pkgrel=0
pkgdesc="Answer set solver for (extended) normal logic programs"
url="https://potassco.org/"
arch="all"
license="MIT"
makedepends="cmake"
source="https://github.com/potassco/clasp/releases/download/v$pkgver/clasp-$pkgver-source.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCLASP_BUILD_APP=ON \
		-DCLASP_BUILD_TESTS=ON \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		$CMAKE_CROSSOPTS .
	make
}

check() {
	make test CTEST_OUTPUT_ON_FAILURE=1
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
09b6ed2ac4112261b706444122a88403d70b4714efaca04bb3c6510fb40b7bdd00b23fda10d94457d1a7f97d471516d6f6de9d46cf8ac9d2c23d7c4f97c83475  clasp-3.3.7-source.tar.gz
"
